﻿namespace hr_1.Model
{
    public class WorkActivity
    {
        HRDataContext hrData = new HRDataContext();
        public int WorkActivityId { get; set; }
        public string Contract { get; set; }
        public string DateHire { get; set; }
        public string Department { get; set; }
        public string PositionGroup { get; set; }
        public string Position { get; set; }
        public string Salary { get; set; } 
        public string DateDismissal { get; set; }
        public string Rate { get; set; }
        public string Experience { get; set; }
        public int EmployeeNumber { get; set; }

        public WorkActivity() { }

        public void Save()
        {
            work_activity NewWorkActivity = new work_activity
            {
                contract = Contract,
                data_hire = DateHire,
                department = Department,
                position_group = PositionGroup,
                position = Position,
                salary = Salary,
                date_dismissal = DateDismissal,
                rate =  Rate,
                experience = Experience,
                employee_number = EmployeeNumber
            };
            hrData.work_activities.InsertOnSubmit(NewWorkActivity);
            hrData.SubmitChanges();
            WorkActivityId = NewWorkActivity.work_activityId;
        }
    }
}
